package com.xbongbong.paas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;

/**
 * @author: wufeng
 * @date: 2018/10/22 13:55
 * @desrcption: 下拉框和下拉复选的字段（下拉框-选项-关联其他表单能显示的字段）
 */
public enum ComboLinkFieldEnum {

    // 单行文本
    TEXT(1, "text", "basic", "enum.comboLinkField.description.text"),
    // 多行文本
    TEXTAREA(7, "textarea", "basic", "enum.comboLinkField.description.textarea"),
    //数字
    NUM(2, "num", "basic", "enum.comboLinkField.description.num"),
    // radiogroup 单选按钮
    RADIOGROUP(10000, "radiogroup", "basic", "enum.comboLinkField.description.radiogroup"),
    // 复选框组：checkboxgroup
    CHECKBOXGROUP(9, "checkboxgroup", "basic", "enum.comboLinkField.description.checkboxgroup"),
    // 下拉框:combo
    COMBO(3, "combo", "basic", "enum.comboLinkField.description.combo"),
    // 下拉框复选：combocheck
    COMBOCHECK(10001, "combocheck", "basic", "enum.comboLinkField.description.combocheck"),
    //阶段推进器
    STAGE_THRUSTER(10030, "stage_thruster", "complex", "enum.comboLinkField.description.stageThruster");

    /**
     * 字段类型
     */
    private Integer type;
    /**
     * 字段类型英文
     */
    private String alias;
    /**
     * 字段所属
     */
    private String belong;

    /**
     * 字段描述
     */
    private String description;

    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public String getAlias() {
        return alias;
    }

    public void setAlias(String alias) {
        this.alias = alias;
    }

    public String getBelong() {
        return belong;
    }

    public void setBelong(String belong) {
        this.belong = belong;
    }

    public String getDescription() {
        return I18nMessageUtil.getMessage(description);
    }

    public void setDescription(String description) {
        this.description = description;
    }

    ComboLinkFieldEnum(Integer type, String alias, String belong, String description){
        this.type = type;
        this.alias = alias;
        this.belong = belong;
        this.description = description;
    }

    public static ComboLinkFieldEnum getComboLinkFieldEnum(Integer type){
        for (ComboLinkFieldEnum comboLinkField: values()) {
            if(type.equals(comboLinkField.getType())){
                return comboLinkField;
            }
        }
        return null;
    }
}
